<?php
namespace Application\Service;
use Doctrine\ORM\EntityManager;
use Application\Entity\Province;
use Application\Component\AbstractComponent;
/**
 * CountryServcie
 *
 */
class ProvinceComponent extends  AbstractComponent
{
    protected  $entity="Application\\Entity\\Province";

	function insert($province)
	{
		$this->em->persist($province);
		$this->em->flush();
	}
	
	
	function update($province)
	{
		$this->em->persist($province);
		$this->em->flush();
	}
	
	
	
	function getAll()
	{
		$province = $this->em->getRepository($this->entity)->findAll();
		return  $province;
	}
	
	
	
	function getByCountry($code)
	{
		$province = $this->em->getRepository($this->entity)->getByCountry($code);
		return  $province;
	}
	
	function getByNameCountry($name,$code)
	{
		$province = $this->em->getRepository($this->entity)->getByNameCountry($name,$code);
		return  $province;
	}
}
